package com.shfl.task.logic.constants;

public class CommonConstants {

    public enum JobType {
        LOCAL((byte) 0, "本地"),
        REMOTE((byte) 1, "远程"),

        ;
        Byte code;
        String des;

        JobType(Byte code, String des) {
            this.code = code;
            this.des = des;
        }

        public static String getName(Byte code) {
            for (JobType jobType : JobType.values()) {
                if (jobType.code.equals(code)) {
                    return jobType.getDes();
                }
            }
            return "";
        }

        public Byte getCode() {
            return code;
        }

        public void setCode(Byte code) {
            this.code = code;
        }

        public String getDes() {
            return des;
        }

        public void setDes(String des) {
            this.des = des;
        }
    }

    public enum JobStatus {
        OPEN((byte) 0, "已开启"),
        CLOSE((byte) 1, "已关闭"),
        ERROR_CLOSE((byte) 2, "异常关闭"),
        ;
        Byte code;
        String des;

        JobStatus(Byte code, String des) {
            this.code = code;
            this.des = des;
        }

        public static String getName(Byte code) {
            for (JobStatus jobStatus : JobStatus.values()) {
                if (jobStatus.code.equals(code)) {
                    return jobStatus.getDes();
                }
            }
            return "";
        }

        public Byte getCode() {
            return code;
        }

        public void setCode(Byte code) {
            this.code = code;
        }

        public String getDes() {
            return des;
        }

        public void setDes(String des) {
            this.des = des;
        }
    }

    public enum TaskLogStatus {
        VETO_JOB(0, "未被执行"),
        MISS(1, "错过执行"),
        SUCCESS(2, "成功执行"),
        FAILURE(3, "异常执行"),
        ;
        Integer code;
        String des;

        TaskLogStatus(Integer code, String des) {
            this.code = code;
            this.des = des;
        }

        public static String getName(Integer code) {
            for (TaskLogStatus taskLogStatus : TaskLogStatus.values()) {
                if (taskLogStatus.code.equals(code)) {
                    return taskLogStatus.getDes();
                }
            }
            return "";
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDes() {
            return des;
        }

        public void setDes(String des) {
            this.des = des;
        }
    }
}
